<?php




define("PUB_PATH","./Public/");
define("Conf_PATH","./xqlsphp/Conf/");
define("Core_PATH","./xqlsphp/Core/");
define("LIB_PATH","./xqlsphp/Lib/");


include_once Conf_PATH."fun.inc.php";



$module = isset($_GET['m']) ? ucfirst(strtolower($_GET['m'])): c('DEFAULT_MODULE');
//控制器
$controller =isset($_GET['c']) ? ucfirst(strtolower($_GET['c'])) : c('DEFAULT_CONTROLLER');
//方法
$action = isset($_GET['a']) ? ucfirst(strtolower($_GET['a'])) : c('DEFAULT_ACTION');

//var_dump($module,$controller,$action);exit();
function __autoload($classname)
{
    //自类可能存在的路径
    $paths = array(
        CONTROLLER_PATH.'/'.$classname.".class.php",
        MODUEL_PATH.'/'.$classname.".class.php",
        Core_PATH.'/'.$classname.".class.php",
    );
//    var_dump($paths);

    //循环判断类文件是否存在
    foreach ($paths as $path) {
        if(file_exists($path)){
            include $path;
            return;
        }
    }
}

//模块常量
define("MODUEL_PATH",APP_PATH.$module);
//控制常量
define("CONTROLLER_PATH", MODUEL_PATH.'/Controller');
//模型常量
define("MODEL_PATH", MODUEL_PATH.'/Model');
//视力路径常量
define("VIEW_PATH", MODUEL_PATH.'/View');

//控制常量名
define("CONTROLLER_NAME",$controller);

//方法名
define("ACTION_NAME",$action);

//类名
$controller=$controller."Controller";
//var_dump($controller);exit();
//var_dump(CONTROLLER_PATH);exit();
$obj=new $controller;


$obj->$action();